#-*- coding: utf8 -*-
from tutor.scripts import *
from tutor.plugins.maple import *

# variáveis úteis
half = M('1/2')
t = M.t
_i, _j, _k = M('_i, _j, _k')
rr = M('`..`')
coeff = M.coeff

n_iter = 0
while True:
    with display_block('Entradas'):
        c1 = M(oneof(-2, -1, 1, 1, -1, -2, 3))
        c2 = M(oneof(-2, -1, 1, 1, -1, -2, 3))
        c3 = M(oneof(-2, -1, 1, 1, -1, -2, 3))
        c4 = M(oneof(-2, -1, 1, 1, -1, -2, 3))
        c5 = M(oneof(-2, -1, 1, 1, -1, -2, 3))
        c6 = M(oneof(-2, -1, 1, 1, -1, -2, 3))
        c7 = M(oneof(-2, -1, 1, 1, -1, -2, 3))
        c8 = M(oneof(1, 2))
        F = fieldF = (c1 * x + c2 * y) * _i + \
                     (c3 * x + c4 * z) * _j + \
                     (c5 * z + c6 * y + c7) * _k

    with display_block('Resultados'):
        n_iter += 1
        campo = (c1 + c5) * 4 * Pi / 3 * c8 ** 3
        intarea = (c1 + c5) * 4 * Pi * c8 ** 2
        nodiv = c7 * 4 * Pi / 3 * c8 ** 3

        distr1 = oneof(campo, intarea, nodiv) * oneof(-2, -1, 1, 2, 4) / M(oneof(-2, -1, 1, 2, 4))
        distr2 = oneof(campo, intarea, nodiv) * oneof(-2, -1, 1, 2, 4) / M(oneof(-2, -1, 1, 2, 4))

        if len(set([campo, intarea, nodiv, distr1, distr2])) == 5:
            break
